home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / cbibcode.arc / GTMXCLR.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-08-05  |  747 b   |  32 lines

  1. /* getmaxcolor */
  2.  
  3. #include <stdio.h>
  4. #include <graphics.h>
  5.  
  6. main()
  7. {
  8.     int graphdriver = DETECT,graphmode;
  9.     int i,maxcol;
  10.     char buffer[80];
  11.  
  12. /*  Initialize the graphics system */
  13.  
  14.     initgraph(&graphdriver,&graphmode, "c:\\turboc");
  15.     outtextxy(10,20,"Demonstrating getmaxcolor");
  16.  
  17. /*  Get maximum color number and it it */
  18.  
  19.     maxcol = getmaxcolor();
  20.     sprintf(buffer,"Maximum color number is 5d",maxcol);
  21.     outtextxy(10,60,buffer);
  22.     outtextxy(10,80,"Here are all the colors");
  23.     for (i=0;i<=maxcol;i++)
  24.     {
  25.         setfillstyle(SOLID_FILL,i);
  26.         bar(100,100+(i-1)*10,120,100+i*10);
  27.     }
  28. /*  Give user a chance to see the result   */
  29.     outtextxy(10,270,"Hit any key to exit:");
  30.     getch();
  31.     closegraph();  /* Close graphics system */
  32. }